home *** CD-ROM | disk | FTP | other *** search
- #include <math.h>
-
- #include "tankwars.h"
-
- extern HDC hDC;
- extern GLuint texture[TOTAL_TEXTURES];
- extern GLuint model[TOTAL_MODELS];
-
- extern int heightmap[31][21];
- extern unsigned char lightmap[30][20];
- extern int grid[30][20];
-
- extern float explosionmap[20][20];
- // Brightness map affected by explosions. Values range from 0 to 1
- float brightmap[30][20];
-
- extern float cameraangle;
-
- extern int screen_h;
- extern int screen_w;
-
- extern float fps;
-
- void renderterrain(void);
- void rendergrid(void);
- void rendertanks(void);
- void rendermissles(void);
- void rendersmoke(void);
- void rendergrenades(void);
- void renderexplosions(void);
- void renderparticles(void);
- void renderdebris(void);
- void renderfog(void);
- void renderrain(void);
- void renderwall(void);
- void renderstatus(void);
-
- void createbigexplosion(int xpos, int ypos);
-
- extern c_player player[2];
-
- extern c_explosion explosion[50];
- extern int nextexplosionslot;
-
- extern c_missle missle[20];
- extern int nextmissleslot;
-
- extern c_smoke smoke[50];
- extern int nextsmokeslot;
-
- extern c_grenade grenade[20];
- extern int nextgrenadeslot;
-
- extern c_particle particle[500];
- extern int nextparticleslot;
-
- extern c_debris debris[100];
- extern int nextdebrisslot;
-
- extern unsigned long wall;
-
- c_rain rain[500];
-
- extern int winner;
-
- extern int fogenabled;
- extern int timeofday;
- extern int raindensity;
-
- int DrawGLScene(GLvoid)
- {
- int x, y, loop;
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- // Position the origin to top left corner of grid
- glLoadIdentity();
- glTranslatef(0, 30, -350);
- glRotatef(cameraangle, -1, 0, 0);
- glTranslatef(-150, 100, 0);
- glScalef(1, -1, 1);
-
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // If daytime:
- if(timeofday==0)
- brightmap[x][y]=0.4f;
- // If nighttime:
- else
- brightmap[x][y]=0.0f;
- for(loop=0; loop<50; loop++)
- {
- if(explosion[loop].stage>0 && x>explosion[loop].pos.x-10 && x<explosion[loop].pos.x+10 && y>explosion[loop].pos.y-10 && y<explosion[loop].pos.y+10)
- {
- if(explosion[loop].stage<10)
- brightmap[x][y]+=explosionmap[x-explosion[loop].pos.x+10][y-explosion[loop].pos.y+10]*((float)explosion[loop].stage/(float)10)*0.5f;
- else
- brightmap[x][y]+=explosionmap[x-explosion[loop].pos.x+10][y-explosion[loop].pos.y+10]*((float)1-(float)(explosion[loop].stage-10)/(float)10)*0.5f;
- }
- }
- }
- }
-
- rendergrid();
- renderterrain();
- rendermissles();
- rendersmoke();
- rendergrenades();
- renderdebris();
- renderwall();
- rendertanks();
- renderexplosions();
- renderparticles();
- renderrain();
- renderfog();
-
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_DEPTH_TEST);
- glBegin(GL_TRIANGLE_FAN);
- glColor3f(0.0f, 0.0f, 0.0f);
- glVertex3f(150, 500, 0);
- for(x=30; x>=0; x--)
- {
- glVertex3f((float)(x*10), 200, (float)heightmap[x][20]);
- }
- glEnd();
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
-
- glLoadIdentity();
- renderstatus();
-
- glColor3f(1.0f, 0.0f, 0.0f);
- glPrint(0, 460, 0, "FPS: %d", (int)fps);
-
- glColor3f(0.0f, 1.0f, 0.0f);
- glPrint(100, 460, 0, "Press <SPACE> to disable/enable frame rate limiter");
-
- glColor3f(1.0f, 1.0f, 0.0f);
- glPrint(0, 440, 0, "Click and drag mouse to change view");
-
- glColor3f(0.8f, 0.8f, 0.8f);
- glPrint(0, 420, 0, "Press 1 - 3 to toggle fog, rain, day/night");
-
- // Flush the data and swap the front and back buffers:
- glFlush();
- SwapBuffers(hDC);
- return TRUE;
- }
-
- void renderterrain(void)
- {
- int x, y;
- glBindTexture(GL_TEXTURE_2D, texture[GROUND_TEXTURE]);
-
- glBegin(GL_TRIANGLES);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y && player[0].rebirth==0) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y && player[1].rebirth==0))
- if(grid[x][y]==EMPTY)
- glColor3f(0, (float)lightmap[x][y]/(float)255+brightmap[x][y], 0);
- else
- glColor3f((float)lightmap[x][y]/(float)255+brightmap[x][y], 0, 0);
- else
- glColor3f((float)lightmap[x][y]/(float)255+brightmap[x][y], (float)lightmap[x][y]/(float)255+brightmap[x][y], (float)lightmap[x][y]/(float)255+brightmap[x][y]);
-
- glTexCoord2f((float)(x+1)/(float)30, (float)1-(float)y/(float)20);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- glTexCoord2f((float)x/(float)30, (float)1-(float)y/(float)20);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f((float)x/(float)30, (float)1-(float)(y+1)/(float)20);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
-
- glTexCoord2f((float)x/(float)30, (float)1-(float)(y+1)/(float)20);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f((float)(x+1)/(float)30, (float)1-(float)(y+1)/(float)20);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f((float)(x+1)/(float)30, (float)1-(float)y/(float)20);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- }
- glEnd();
- }
-
- void rendergrid(void)
- {
- int x, y;
-
- glDisable(GL_BLEND);
-
- // Draw all the MINE
- glBindTexture(GL_TEXTURE_2D, texture[MINE_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render MINE:
- if(grid[x][y]==MINE)
- {
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]+1);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]+1);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]+1);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]+1);
- }
- }
- }
- glEnd();
-
- // Draw all of the BRICK1
- glBindTexture(GL_TEXTURE_2D, texture[BRICK1_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render BRICK:
- if(grid[x][y]==BRICK1)
- {
- if(!(player[0].rebirth==0 && player[0].mode==MISSLE_MODE && (x>=(int)(player[0].pos.x/10)-1 && x<=(int)(player[0].pos.x/10)+1 && y>=(int)(player[0].pos.y/10)-1 && y<=(int)(player[0].pos.y/10)+1) ) &&
- !(player[1].rebirth==0 && player[1].mode==MISSLE_MODE && (x>=(int)(player[1].pos.x/10)-1 && x<=(int)(player[1].pos.x/10)+1 && y>=(int)(player[1].pos.y/10)-1 && y<=(int)(player[1].pos.y/10)+1) ))
- {
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- }
- glEnd();
-
- // Draw all of the BRICK0
- glBindTexture(GL_TEXTURE_2D, texture[BRICK0_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render BRICK:
- if(grid[x][y]==BRICK0 && (player[0].mode!=MISSLE_MODE || !(player[0].buildpos.x==x && player[0].buildpos.y==y)) && (player[1].mode!=MISSLE_MODE || !(player[1].buildpos.x==x && player[1].buildpos.y==y)))
- {
- if(!(player[0].rebirth==0 && player[0].mode==MISSLE_MODE && (x>=(int)(player[0].pos.x/10)-1 && x<=(int)(player[0].pos.x/10)+1 && y>=(int)(player[0].pos.y/10)-1 && y<=(int)(player[0].pos.y/10)+1) ) &&
- !(player[1].rebirth==0 && player[1].mode==MISSLE_MODE && (x>=(int)(player[1].pos.x/10)-1 && x<=(int)(player[1].pos.x/10)+1 && y>=(int)(player[1].pos.y/10)-1 && y<=(int)(player[1].pos.y/10)+1) ))
- {
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- }
- glEnd();
- // Draw all of the TRUNK
- glBindTexture(GL_TEXTURE_2D, texture[TRUNK_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render TRUNK:
- if(grid[x][y]==TRUNK)
- {
-
- // Front Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+7), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+7), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+7), (float)0);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+7), (float)0);
- // Left Face:
- if(x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+7), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+3), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+3), (float)0);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+7), (float)0);
- }
- // Right Face:
- if(x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+3), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+7), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+7), (float)0);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+3), (float)0);
- }
- // Top Face:
- if(grid[x][y]==TRUNK)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+3), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+3), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+3), (float)(y*10+7), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+7), (float)(y*10+7), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- }
- }
- }
- }
- glEnd();
- // Draw all of the TREE
- glEnable(GL_CULL_FACE);
- glBindTexture(GL_TEXTURE_2D, texture[TREE_TEXTURE]);
- glBegin(GL_TRIANGLES);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render TREE:
- if(grid[x][y]==TREE)
- {
-
- // Front Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.3f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.3f+brightmap[x][y], 0.3f+brightmap[x][y], 0.3f+brightmap[x][y]);
- glTexCoord2f(0.5f, 1.0f);
- glVertex3f((float)(x*10+5), (float)(y*10+5), (float)(19+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+1), (float)(y*10+9), (float)(3+heightmap[x][y+1]));
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+9), (float)(y*10+9), (float)(3+heightmap[x+1][y+1]));
- // Back Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.3f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.3f+brightmap[x][y], 0.3f+brightmap[x][y], 0.3f+brightmap[x][y]);
- glTexCoord2f(0.5f, 1.0f);
- glVertex3f((float)(x*10+5), (float)(y*10+5), (float)(19+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+9), (float)(y*10+1), (float)(3+heightmap[x+1][y]));
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+1), (float)(y*10+1), (float)(3+heightmap[x][y]));
- // Left Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(0.5f, 1.0f);
- glVertex3f((float)(x*10+5), (float)(y*10+5), (float)(19+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+1), (float)(y*10+1), (float)(3+heightmap[x][y]));
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+1), (float)(y*10+9), (float)(3+heightmap[x][y+1]));
- // Right Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(0.5f, 1.0f);
- glVertex3f((float)(x*10+5), (float)(y*10+5), (float)(19+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+9), (float)(y*10+9), (float)(3+heightmap[x+1][y+1]));
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+9), (float)(y*10+1), (float)(3+heightmap[x+1][y]));
- }
- }
- }
- glEnd();
- glDisable(GL_CULL_FACE);
- // Draw all of the REDFLAG and BLUEFLAG
- glDisable(GL_TEXTURE_2D);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render REDFLAG and BLUEFLAG:
- if(grid[x][y]==REDFLAG || grid[x][y]==BLUEFLAG)
- {
-
- // Flag Face:
- if(grid[x][y]==REDFLAG)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.6f+brightmap[x][y], 0.0f, 0.0f);
- }
- else
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.0f, 0.0f, 0.6f+brightmap[x][y]);
- }
- glVertex3f((float)(x*10+9), (float)(y*10+5), (float)(12+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glVertex3f((float)(x*10+1), (float)(y*10+5), (float)(12+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glVertex3f((float)(x*10+1), (float)(y*10+5), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glVertex3f((float)(x*10+9), (float)(y*10+5), (float)(5+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- // Pole:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.3f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.3f+brightmap[x][y], 0.3f+brightmap[x][y], 0.3f+brightmap[x][y]);
- glVertex3f((float)(x*10+1), (float)(y*10+5), (float)(12+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glVertex3f((float)(x*10), (float)(y*10+5), (float)(12+(heightmap[x][y]+heightmap[x+1][y]+heightmap[x][y+1]+heightmap[x+1][y+1])/4));
- glVertex3f((float)(x*10), (float)(y*10+5), (float)0);
- glVertex3f((float)(x*10+1), (float)(y*10+5), (float)0);
- }
- }
- }
- glEnd();
- // Draw all of the REDGATE and BLUEGATE
- glBegin(GL_LINES);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render REDFLAG and BLUEFLAG:
- if(grid[x][y]==REDGATE || grid[x][y]==BLUEGATE)
- {
- if(grid[x][y]==REDGATE)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.6f+brightmap[x][y], 0.0f, 0.0f);
- }
- else
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.0f, 0.0f, 0.6f+brightmap[x][y]);
- }
- glVertex3f((float)(x*10+5), (float)(y*10), (float)10);
- glVertex3f((float)(x*10+5), (float)(y*10), (float)0);
- glVertex3f((float)(x*10+5), (float)(y*10+10), (float)10);
- glVertex3f((float)(x*10+5), (float)(y*10+10), (float)0);
- glVertex3f((float)(x*10), (float)(y*10+5), (float)10);
- glVertex3f((float)(x*10), (float)(y*10+5), (float)0);
- glVertex3f((float)(x*10+10), (float)(y*10+5), (float)10);
- glVertex3f((float)(x*10+10), (float)(y*10+5), (float)0);
- glVertex3f((float)(x*10+5), (float)(y*10), (float)10);
- glVertex3f((float)(x*10+5), (float)(y*10+10), (float)10);
- glVertex3f((float)(x*10), (float)(y*10+5), (float)10);
- glVertex3f((float)(x*10+10), (float)(y*10+5), (float)10);
- glVertex3f((float)(x*10+5), (float)(y*10), (float)6);
- glVertex3f((float)(x*10+5), (float)(y*10+10), (float)6);
- glVertex3f((float)(x*10), (float)(y*10+5), (float)6);
- glVertex3f((float)(x*10+10), (float)(y*10+5), (float)6);
- }
- }
- }
- glEnd();
- glEnable(GL_TEXTURE_2D);
-
- // Draw all of the LIFE_POWERUP
- glBindTexture(GL_TEXTURE_2D, texture[LIFE_POWERUP_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render LIFE_POWERUP:
- if(grid[x][y]==LIFE_POWERUP)
- {
-
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- glEnd();
- // Draw all of the BRICK_POWERUP
- glBindTexture(GL_TEXTURE_2D, texture[BRICK_POWERUP_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render LIFE_POWERUP:
- if(grid[x][y]==BRICK_POWERUP)
- {
-
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- glEnd();
- // Draw all of the MINE_POWERUP
- glBindTexture(GL_TEXTURE_2D, texture[MINE_POWERUP_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render LIFE_POWERUP:
- if(grid[x][y]==MINE_POWERUP)
- {
-
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- glEnd();
- // Draw all of the MISSLE_POWERUP
- glBindTexture(GL_TEXTURE_2D, texture[MISSLE_POWERUP_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render LIFE_POWERUP:
- if(grid[x][y]==MISSLE_POWERUP)
- {
-
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- glEnd();
- // Draw all of the GRENADE_POWERUP
- glBindTexture(GL_TEXTURE_2D, texture[GRENADE_POWERUP_TEXTURE]);
- glBegin(GL_QUADS);
- for(y=0; y<20; y++)
- {
- for(x=0; x<30; x++)
- {
- // Render LIFE_POWERUP:
- if(grid[x][y]==GRENADE_POWERUP)
- {
-
- // Front Face:
- if(y==19 || (grid[x][y+1]!=BRICK1 && grid[x][y+1]!=BRICK0))
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.2f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- }
- // Left Face:
- if((x==0 || (grid[x-1][y]!=BRICK1 && grid[x-1][y]!=BRICK1)) && x>15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- }
- // Right Face:
- if((x==29 || (grid[x+1][y]!=BRICK1 && grid[x+1][y]!=BRICK1)) && x<15)
- {
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.1f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- }
- // Top Face:
- if(((player[0].mode==BRICK_MODE || player[0].mode==MINE_MODE) && x==player[0].buildpos.x && y==player[0].buildpos.y) || ((player[1].mode==BRICK_MODE || player[1].mode==MINE_MODE) && x==player[1].buildpos.x && y==player[1].buildpos.y))
- glColor3f(0.4f+brightmap[x][y], 0.0f, 0.0f);
- else
- glColor3f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y]);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- }
- }
- }
- glEnd();
-
- }
-
- void rendertanks(void)
- {
- int i, x, y;
-
- for(i=0; i<2; i++)
- {
- glEnable(GL_TEXTURE_2D);
- if(i==0)
- glBindTexture(GL_TEXTURE_2D, texture[REDTANK_TEXTURE]);
- if(i==1)
- glBindTexture(GL_TEXTURE_2D, texture[BLUETANK_TEXTURE]);
- glTranslatef(player[i].pos.x, player[i].pos.y, (float)(heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)+1]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)+1])/(float)4);
- glTranslatef(0, 0, -((float)player[i].rebirth/(float)10));
- glRotatef((float)player[i].rot, 0, 0, 1);
- glCallList(model[TANK_MODEL]);
- glDisable(GL_TEXTURE_2D);
- if(player[i].mode==MISSLE_MODE && player[i].rebirth==0)
- {
- glDisable(GL_DEPTH_TEST);
- glEnable(GL_BLEND);
- glBegin(GL_QUADS);
- if(player[i].missleload==0)
- glColor4f(0.3f, 1.0f, 0.0f, 0.2f);
- else
- glColor4f(0.8f, 0.8f, 0.0f, 0.2f);
- glVertex3f(33, -0.5f, 5);
- glVertex3f(27, -0.5f, 5);
- glVertex3f(27, 0.5f, 5);
- glVertex3f(33, 0.5f, 5);
- glVertex3f(30.5f, -3, 5);
- glVertex3f(29.5f, -3, 5);
- glVertex3f(29.5f, 3, 5);
- glVertex3f(30.5f, 3, 5);
- glEnd();
- glEnable(GL_DEPTH_TEST);
- glRotatef((float)-player[i].rot, 0, 0, 1);
- glTranslatef(0, 0, (float)player[i].rebirth/(float)10);
- glTranslatef(-player[i].pos.x, -player[i].pos.y, -((float)(heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)+1]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)+1])/(float)4));
- glEnable(GL_TEXTURE_2D);
- for((int)(player[i].pos.y/10)>=0 ? y=(int)(player[i].pos.y/10)-1 : y=0; y<(int)(player[i].pos.y/10)+2 && y<20; y++)
- for((int)(player[i].pos.x/10)>=0 ? x=(int)(player[i].pos.x/10)-1 : x=0; x<(int)(player[i].pos.x/10)+2 && x<30; x++)
- {
- if(grid[x][y]==BRICK1)
- glBindTexture(GL_TEXTURE_2D, texture[BRICK1_TEXTURE]);
- else if(grid[x][y]==BRICK0)
- glBindTexture(GL_TEXTURE_2D, texture[BRICK0_TEXTURE]);
- else
- continue;
- glBegin(GL_QUADS);
- // Back Face:
- glColor4f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 1.0f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x+1][y+1]);
- // Front Face:
- glColor4f(0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 0.2f+brightmap[x][y], 1.0f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- // Left Face:
- glColor4f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 1.0f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)heightmap[x][y]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)heightmap[x][y+1]);
- // Right Face:
- glColor4f(0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 0.1f+brightmap[x][y], 1.0f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)heightmap[x+1][y+1]);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)heightmap[x+1][y]);
- // Top Face:
- glColor4f(0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 0.4f+brightmap[x][y], 1.0f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f((float)(x*10+10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f((float)(x*10), (float)(y*10), (float)10);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f((float)(x*10), (float)(y*10+10), (float)10);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f((float)(x*10+10), (float)(y*10+10), (float)10);
- glEnd();
- }
- glTranslatef(0, 0, (float)player[i].rebirth/(float)10);
- glTranslatef(player[i].pos.x, player[i].pos.y, (float)(heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)+1]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)+1])/(float)4);
- glRotatef((float)player[i].rot, 0, 0, 1);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
- }
- glRotatef((float)-player[i].rot, 0, 0, 1);
- glTranslatef(0, 0, (float)player[i].rebirth/(float)10);
- glTranslatef(-player[i].pos.x, -player[i].pos.y, -((float)(heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)]+heightmap[(int)(player[i].pos.x/10)][(int)(player[i].pos.y/10)+1]+heightmap[(int)(player[i].pos.x/10)+1][(int)(player[i].pos.y/10)+1])/(float)4));
- if(player[i].mode==GRENADE_MODE && player[i].rebirth==0)
- {
- if(player[i].buildpos.x>=0 && player[i].buildpos.x<30 && player[i].buildpos.y>=0 && player[i].buildpos.y <20)
- {
- glDisable(GL_DEPTH_TEST);
- glEnable(GL_BLEND);
- glBegin(GL_LINES);
- if(grid[player[i].buildpos.x][player[i].buildpos.y]==EMPTY)
- if(player[i].grenadeload==0)
- glColor4f(0.3f, 1.0f, 0.0f, 0.2f);
- else
- glColor4f(0.8f, 0.8f, 0.0f, 0.2f);
- else
- glColor4f(1.0f, 0.3f, 0.0f, 0.2f);
- glVertex3f((float)player[i].buildpos.x*10+5, (float)player[i].buildpos.y*10+5, 10.0f);
- glVertex3f((float)player[i].buildpos.x*10+5, (float)player[i].buildpos.y*10+5, 0.0f);
- glVertex3f((float)player[i].buildpos.x*10, (float)player[i].buildpos.y*10+5, 5.0f);
- glVertex3f((float)player[i].buildpos.x*10+10, (float)player[i].buildpos.y*10+5, 5.0f);
- glVertex3f((float)player[i].buildpos.x*10+5, (float)player[i].buildpos.y*10, 5.0f);
- glVertex3f((float)player[i].buildpos.x*10+5, (float)player[i].buildpos.y*10+10, 5.0f);
- glEnd();
- glDisable(GL_BLEND);
- glEnable(GL_DEPTH_TEST);
- }
- }
- }
- glEnable(GL_TEXTURE_2D);
- }
-
- void rendermissles(void)
- {
- int i;
- glBindTexture(GL_TEXTURE_2D, texture[MISSLE_TEXTURE]);
-
- for(i=0; i<20; i++)
- {
- if(missle[i].active)
- {
- glTranslatef(missle[i].pos.x, missle[i].pos.y, (float)0);
- glRotatef((float)missle[i].rot, 0, 0, 1);
- glBegin(GL_TRIANGLES);
- glColor3f(1.0f, 1.0f, 1.0f);
- glTexCoord2f(0.5f, 1.0f);
- glVertex3f(3, 0, 8);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(-3, -2, 8);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(-3, 2, 8);
- glEnd();
- glRotatef((float)-missle[i].rot, 0, 0, 1);
- glTranslatef(-missle[i].pos.x, -missle[i].pos.y, (float)0);
- }
- }
- }
-
- void rendersmoke(void)
- {
- int i;
- glEnable(GL_BLEND);
- glBindTexture(GL_TEXTURE_2D, texture[SMOKE_TEXTURE]);
-
- for(i=0; i<50; i++)
- {
- if(smoke[i].active)
- {
- glTranslatef(smoke[i].pos.x, smoke[i].pos.y, (float)0);
- glRotatef((float)smoke[i].rot, 0, 0, 1);
- glBegin(GL_QUADS);
- glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(0, 3, 8);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(0, -3, 8);
- glTexCoord2f(0.0f, 1.0f-(float)smoke[i].length/(float)36);
- glVertex3f(-(float)smoke[i].length, -4, 8);
- glTexCoord2f(1.0f, 1.0f-(float)smoke[i].length/(float)36);
- glVertex3f(-(float)smoke[i].length, 4, 8);
- glEnd();
- glRotatef((float)-smoke[i].rot, 0, 0, 1);
- glTranslatef(-smoke[i].pos.x, -smoke[i].pos.y, (float)0);
-
- if(smoke[i].stillmoving)
- {
- smoke[i].pos.x+=(float)cos(smoke[i].rot*PI/180)*4;
- smoke[i].pos.y+=(float)sin(smoke[i].rot*PI/180)*4;
- }
-
- smoke[i].life++;
- if(smoke[i].stillmoving && smoke[i].life<10)
- smoke[i].length+=4;
-
- if(smoke[i].stillmoving==0)
- {
- smoke[i].length-=4;
- if(smoke[i].length<=0)
- {
- smoke[i].active=0;
- if(i<nextsmokeslot)
- nextsmokeslot=i;
- }
- }
- }
- }
- glDisable(GL_BLEND);
- }
-
- void rendergrenades(void)
- {
- int i;
- glDisable(GL_TEXTURE_2D);
-
- for(i=0; i<20; i++)
- {
- if(grenade[i].stage>0)
- {
- glBegin(GL_QUADS);
- glColor3f(0.0f, 0.2f, 0.0f);
- glVertex3f((float)(grenade[i].pos.x*10+8), (float)(grenade[i].pos.y*10+2), (float)(heightmap[grenade[i].pos.x][grenade[i].pos.y]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y]+heightmap[grenade[i].pos.x][grenade[i].pos.y+1]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y+1])/(float)4+(float)grenade[i].stage/(float)3);
- glVertex3f((float)(grenade[i].pos.x*10+2), (float)(grenade[i].pos.y*10+2), (float)(heightmap[grenade[i].pos.x][grenade[i].pos.y]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y]+heightmap[grenade[i].pos.x][grenade[i].pos.y+1]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y+1])/(float)4+(float)grenade[i].stage/(float)3);
- glVertex3f((float)(grenade[i].pos.x*10+2), (float)(grenade[i].pos.y*10+8), (float)(heightmap[grenade[i].pos.x][grenade[i].pos.y]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y]+heightmap[grenade[i].pos.x][grenade[i].pos.y+1]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y+1])/(float)4+(float)grenade[i].stage/(float)3);
- glVertex3f((float)(grenade[i].pos.x*10+8), (float)(grenade[i].pos.y*10+8), (float)(heightmap[grenade[i].pos.x][grenade[i].pos.y]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y]+heightmap[grenade[i].pos.x][grenade[i].pos.y+1]+heightmap[grenade[i].pos.x+1][grenade[i].pos.y+1])/(float)4+(float)grenade[i].stage/(float)3);
- glEnd();
- grenade[i].stage--;
-
- if(grenade[i].stage==0)
- {
- if(i<nextgrenadeslot)
- nextgrenadeslot=i;
- createbigexplosion(grenade[i].pos.x, grenade[i].pos.y);
- }
- }
- }
- }
-
- void renderexplosions(void)
- {
- int i;
- glDisable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
-
- for(i=0; i<50; i++)
- {
- if(explosion[i].stage>0)
- {
- glTranslatef((float)(explosion[i].pos.x)*10+5, (float)(explosion[i].pos.y)*10+5, 0);
- glScalef(20, 20, (float)(20-explosion[i].stage));
- glBegin(GL_TRIANGLES);
- glColor4f((float)0.886, (float)0.5316, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.1, (float)0.173205, (float)0.2); glVertex3f((float)-0.5, (float)0, (float)0); glVertex3f((float)-0.25, (float)0.433013, (float)0);
- glColor4f((float)0.8045, (float)0.4827, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.1, (float)0.173205, (float)0.2); glVertex3f((float)-0.2, (float)0, (float)0.2); glVertex3f((float)-0.5, (float)0, (float)0);
- glColor4f((float)0.681, (float)0.4086, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.075, (float)0.129904, (float)0.4); glVertex3f((float)-0.2, (float)0, (float)0.2); glVertex3f((float)-0.1, (float)0.173205, (float)0.2);
- glColor4f((float)0.9745, (float)0.5847, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.075, (float)0.129904, (float)0.4); glVertex3f((float)-0.15, (float)0, (float)0.4); glVertex3f((float)-0.2, (float)0, (float)0.2);
- glColor4f((float)0.864, (float)0.5184, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.4, (float)0, (float)0.7); glVertex3f((float)-0.15, (float)0, (float)0.4); glVertex3f((float)-0.075, (float)0.129904, (float)0.4);
- glColor4f((float)0.6775, (float)0.4065, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.2, (float)0.34641, (float)0.7); glVertex3f((float)-0.4, (float)0, (float)0.7); glVertex3f((float)-0.075, (float)0.129904, (float)0.4);
- glColor4f((float)0.5455, (float)0.3273, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.15, (float)0.259808, (float)0.9); glVertex3f((float)-0.4, (float)0, (float)0.7); glVertex3f((float)-0.2, (float)0.34641, (float)0.7);
- glColor4f((float)0.8505, (float)0.5103, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.15, (float)0.259808, (float)0.9); glVertex3f((float)-0.3, (float)0, (float)0.9); glVertex3f((float)-0.4, (float)0, (float)0.7);
- glColor4f((float)0.8585, (float)0.5151, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0, (float)0, (float)1); glVertex3f((float)-0.3, (float)0, (float)0.9); glVertex3f((float)-0.15, (float)0.259808, (float)0.9);
- glColor4f((float)0.755, (float)0.453, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.25, (float)0.433013, (float)0); glVertex3f((float)-0.1, (float)0.173205, (float)0.2); glVertex3f((float)-0.25, (float)0.433013, (float)0);
- glColor4f((float)0.538, (float)0.3228, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.1, (float)0.173205, (float)0.2); glVertex3f((float)-0.1, (float)0.173205, (float)0.2); glVertex3f((float)0.25, (float)0.433013, (float)0);
- glColor4f((float)0.6235, (float)0.3741, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.1, (float)0.173205, (float)0.2); glVertex3f((float)-0.075, (float)0.129904, (float)0.4); glVertex3f((float)-0.1, (float)0.173205, (float)0.2);
- glColor4f((float)0.8815, (float)0.5289, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.075, (float)0.129904, (float)0.4); glVertex3f((float)-0.075, (float)0.129904, (float)0.4); glVertex3f((float)0.1, (float)0.173205, (float)0.2);
- glColor4f((float)0.566, (float)0.3396, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.075, (float)0.129904, (float)0.4); glVertex3f((float)-0.2, (float)0.34641, (float)0.7); glVertex3f((float)-0.075, (float)0.129904, (float)0.4);
- glColor4f((float)0.8875, (float)0.5325, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)0.34641, (float)0.7); glVertex3f((float)-0.2, (float)0.34641, (float)0.7); glVertex3f((float)0.075, (float)0.129904, (float)0.4);
- glColor4f((float)0.969, (float)0.5814, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)0.34641, (float)0.7); glVertex3f((float)-0.15, (float)0.259808, (float)0.9); glVertex3f((float)-0.2, (float)0.34641, (float)0.7);
- glColor4f((float)0.5375, (float)0.3225, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.15, (float)0.259808, (float)0.9); glVertex3f((float)-0.15, (float)0.259808, (float)0.9); glVertex3f((float)0.2, (float)0.34641, (float)0.7);
- glColor4f((float)0.5395, (float)0.3237, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.15, (float)0.259808, (float)0.9); glVertex3f((float)0, (float)0, (float)1); glVertex3f((float)-0.15, (float)0.259808, (float)0.9);
- glColor4f((float)0.8795, (float)0.5277, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)-0, (float)0.2); glVertex3f((float)0.1, (float)0.173205, (float)0.2); glVertex3f((float)0.25, (float)0.433013, (float)0);
- glColor4f((float)0.536, (float)0.3216, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.5, (float)-0, (float)0); glVertex3f((float)0.2, (float)-0, (float)0.2); glVertex3f((float)0.25, (float)0.433013, (float)0);
- glColor4f((float)0.841, (float)0.5046, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)-0, (float)0.2); glVertex3f((float)0.075, (float)0.129904, (float)0.4); glVertex3f((float)0.1, (float)0.173205, (float)0.2);
- glColor4f((float)0.92, (float)0.552, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.15, (float)-0, (float)0.4); glVertex3f((float)0.075, (float)0.129904, (float)0.4); glVertex3f((float)0.2, (float)-0, (float)0.2);
- glColor4f((float)0.755, (float)0.453, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.4, (float)-0, (float)0.7); glVertex3f((float)0.2, (float)0.34641, (float)0.7); glVertex3f((float)0.075, (float)0.129904, (float)0.4);
- glColor4f((float)0.681, (float)0.4086, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.15, (float)-0, (float)0.4); glVertex3f((float)0.4, (float)-0, (float)0.7); glVertex3f((float)0.075, (float)0.129904, (float)0.4);
- glColor4f((float)0.798, (float)0.4788, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.4, (float)-0, (float)0.7); glVertex3f((float)0.15, (float)0.259808, (float)0.9); glVertex3f((float)0.2, (float)0.34641, (float)0.7);
- glColor4f((float)0.9065, (float)0.5439, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.3, (float)-0, (float)0.9); glVertex3f((float)0.15, (float)0.259808, (float)0.9); glVertex3f((float)0.4, (float)-0, (float)0.7);
- glColor4f((float)0.953, (float)0.5718, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.3, (float)-0, (float)0.9); glVertex3f((float)0, (float)0, (float)1); glVertex3f((float)0.15, (float)0.259808, (float)0.9);
- glColor4f((float)0.6565, (float)0.3939, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.25, (float)-0.433013, (float)0); glVertex3f((float)0.2, (float)-0, (float)0.2); glVertex3f((float)0.5, (float)-0, (float)0);
- glColor4f((float)0.7415, (float)0.4449, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.1, (float)-0.173205, (float)0.2); glVertex3f((float)0.2, (float)-0, (float)0.2); glVertex3f((float)0.25, (float)-0.433013, (float)0);
- glColor4f((float)0.975, (float)0.585, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.075, (float)-0.129904, (float)0.4); glVertex3f((float)0.15, (float)-0, (float)0.4); glVertex3f((float)0.2, (float)-0, (float)0.2);
- glColor4f((float)0.877, (float)0.5262, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.1, (float)-0.173205, (float)0.2); glVertex3f((float)0.075, (float)-0.129904, (float)0.4); glVertex3f((float)0.2, (float)-0, (float)0.2);
- glColor4f((float)0.949, (float)0.5694, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.075, (float)-0.129904, (float)0.4); glVertex3f((float)0.4, (float)-0, (float)0.7); glVertex3f((float)0.15, (float)-0, (float)0.4);
- glColor4f((float)0.7815, (float)0.4689, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)-0.34641, (float)0.7); glVertex3f((float)0.4, (float)-0, (float)0.7); glVertex3f((float)0.075, (float)-0.129904, (float)0.4);
- glColor4f((float)0.751, (float)0.4506, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.15, (float)-0.259808, (float)0.9); glVertex3f((float)0.3, (float)-0, (float)0.9); glVertex3f((float)0.4, (float)-0, (float)0.7);
- glColor4f((float)0.8635, (float)0.5181, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)-0.34641, (float)0.7); glVertex3f((float)0.15, (float)-0.259808, (float)0.9); glVertex3f((float)0.4, (float)-0, (float)0.7);
- glColor4f((float)0.777, (float)0.4662, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.15, (float)-0.259808, (float)0.9); glVertex3f((float)0, (float)0, (float)1); glVertex3f((float)0.3, (float)-0, (float)0.9);
- glColor4f((float)0.695, (float)0.417, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.1, (float)-0.173205, (float)0.2); glVertex3f((float)0.25, (float)-0.433013, (float)0); glVertex3f((float)-0.25, (float)-0.433013, (float)0);
- glColor4f((float)0.953, (float)0.5718, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.1, (float)-0.173205, (float)0.2); glVertex3f((float)0.1, (float)-0.173205, (float)0.2); glVertex3f((float)-0.25, (float)-0.433013, (float)0);
- glColor4f((float)0.969, (float)0.5814, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.075, (float)-0.129904, (float)0.4); glVertex3f((float)0.1, (float)-0.173205, (float)0.2); glVertex3f((float)-0.1, (float)-0.173205, (float)0.2);
- glColor4f((float)0.9145, (float)0.5487, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.075, (float)-0.129904, (float)0.4); glVertex3f((float)0.075, (float)-0.129904, (float)0.4); glVertex3f((float)0.1, (float)-0.173205, (float)0.2);
- glColor4f((float)0.577, (float)0.3462, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0.2, (float)-0.34641, (float)0.7); glVertex3f((float)0.075, (float)-0.129904, (float)0.4); glVertex3f((float)-0.075, (float)-0.129904, (float)0.4);
- glColor4f((float)0.8955, (float)0.5373, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.2, (float)-0.34641, (float)0.7); glVertex3f((float)0.2, (float)-0.34641, (float)0.7); glVertex3f((float)-0.075, (float)-0.129904, (float)0.4);
- glColor4f((float)0.8345, (float)0.5007, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.15, (float)-0.259808, (float)0.9); glVertex3f((float)0.2, (float)-0.34641, (float)0.7); glVertex3f((float)-0.2, (float)-0.34641, (float)0.7);
- glColor4f((float)0.8905, (float)0.5343, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.15, (float)-0.259808, (float)0.9); glVertex3f((float)0.15, (float)-0.259808, (float)0.9); glVertex3f((float)0.2, (float)-0.34641, (float)0.7);
- glColor4f((float)0.731, (float)0.4386, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0, (float)0, (float)1); glVertex3f((float)0.15, (float)-0.259808, (float)0.9); glVertex3f((float)-0.15, (float)-0.259808, (float)0.9);
- glColor4f((float)0.753, (float)0.4518, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.2, (float)0, (float)0.2); glVertex3f((float)-0.25, (float)-0.433013, (float)0); glVertex3f((float)-0.5, (float)0, (float)0);
- glColor4f((float)0.579, (float)0.3474, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.2, (float)0, (float)0.2); glVertex3f((float)-0.1, (float)-0.173205, (float)0.2); glVertex3f((float)-0.25, (float)-0.433013, (float)0);
- glColor4f((float)0.9225, (float)0.5535, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.075, (float)-0.129904, (float)0.4); glVertex3f((float)-0.1, (float)-0.173205, (float)0.2); glVertex3f((float)-0.2, (float)0, (float)0.2);
- glColor4f((float)0.5835, (float)0.3501, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.15, (float)0, (float)0.4); glVertex3f((float)-0.075, (float)-0.129904, (float)0.4); glVertex3f((float)-0.2, (float)0, (float)0.2);
- glColor4f((float)0.6135, (float)0.3681, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.4, (float)0, (float)0.7); glVertex3f((float)-0.075, (float)-0.129904, (float)0.4); glVertex3f((float)-0.15, (float)0, (float)0.4);
- glColor4f((float)0.8195, (float)0.4917, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.4, (float)0, (float)0.7); glVertex3f((float)-0.2, (float)-0.34641, (float)0.7); glVertex3f((float)-0.075, (float)-0.129904, (float)0.4);
- glColor4f((float)0.783, (float)0.4698, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.15, (float)-0.259808, (float)0.9); glVertex3f((float)-0.2, (float)-0.34641, (float)0.7); glVertex3f((float)-0.4, (float)0, (float)0.7);
- glColor4f((float)0.84, (float)0.504, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)-0.3, (float)0, (float)0.9); glVertex3f((float)-0.15, (float)-0.259808, (float)0.9); glVertex3f((float)-0.4, (float)0, (float)0.7);
- glColor4f((float)0.549, (float)0.3294, (float)0, (float)explosion[i].stage/(float)20);
- glVertex3f((float)0, (float)0, (float)1); glVertex3f((float)-0.15, (float)-0.259808, (float)0.9); glVertex3f((float)-0.3, (float)0, (float)0.9);
- glEnd();
- glScalef((float)1/(float)20, (float)1/(float)20, (float)1/(float)(20-explosion[i].stage));
- glTranslatef(-(float)(explosion[i].pos.x*10+5), -(float)(explosion[i].pos.y*10+5), 0);
- explosion[i].stage--;
- if(explosion[i].stage==0 && i<nextexplosionslot)
- nextexplosionslot=i;
- }
- }
- glDisable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- }
-
- void renderparticles(void)
- {
- int i;
- glEnable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glBegin(GL_POINTS);
- for(i=0; i<500; i++)
- {
- if(particle[i].life>0)
- {
- glColor4f(1.0f, 0.7f, 0.0f, ((float)70-(float)particle[i].life)/(float)70);
- glVertex3f(particle[i].pos.x, particle[i].pos.y, particle[i].pos.z);
- particle[i].pos.x+=particle[i].dir.x;
- particle[i].pos.y+=particle[i].dir.y;
- particle[i].pos.z+=particle[i].dir.z;
- particle[i].dir.z-=0.03f;
- particle[i].life++;
- if(particle[i].pos.z<0)
- {
- particle[i].life=0;
- if(i<nextparticleslot)
- nextparticleslot=i;
- }
- }
- }
- glEnd();
- glDisable(GL_BLEND);
- }
- void renderdebris(void)
- {
- int i;
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, texture[DEBRIS_TEXTURE]);
- glBegin(GL_QUADS);
- for(i=0; i<100; i++)
- {
- if(debris[i].active==1)
- {
- glColor3f(debris[i].color.x, debris[i].color.y, debris[i].color.z);
-
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(debris[i].pos.x+5, debris[i].pos.y-(float)cos(cameraangle*PI/180)*5, debris[i].pos.z+(float)sin(cameraangle*PI/180)*5);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(debris[i].pos.x, debris[i].pos.y-(float)cos(cameraangle*PI/180)*5, debris[i].pos.z+(float)sin(cameraangle*PI/180)*5);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(debris[i].pos.x, debris[i].pos.y, debris[i].pos.z);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(debris[i].pos.x+5, debris[i].pos.y, debris[i].pos.z);
-
- debris[i].pos.x+=debris[i].dir.x;
- debris[i].pos.y+=debris[i].dir.y;
- debris[i].pos.z+=debris[i].dir.z;
- debris[i].dir.z-=0.03f;
- if(debris[i].pos.z<0)
- {
- debris[i].active=0;
- if(i<nextdebrisslot)
- nextdebrisslot=i;
- }
- }
- }
- glEnd();
- }
-
- void renderfog(void)
- {
- float i;
- if(fogenabled)
- {
- glEnable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- glBegin(GL_TRIANGLES);
- for(i=2.0f; i<=12; i+=2.0f)
- {
- glColor4f(1.0f, 1.0f, 1.0f, 0.1f);
- glVertex3f(300.0f, 0.0f, i);
- glVertex3f(0.0f, 0.0f, i);
- glVertex3f(0.0f, 200.0f, i);
-
- glVertex3f(0.0f, 200.0f, i);
- glVertex3f(300.0f, 200.0f, i);
- glVertex3f(300.0f, 0.0f, i);
- }
- glEnd();
- glEnable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
- }
- }
-
- void renderrain(void)
- {
- int i;
- glDisable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
- glBegin(GL_LINES);
- for(i=0; i<raindensity; i++)
- {
- glColor4f(0.0f, 0.5f, 1.0f, 0.6f);
- glVertex3f(rain[i].pos.x, rain[i].pos.y, rain[i].pos.z);
- glColor4f(0.0f, 0.0f, 0.2f, 0.2f);
- glVertex3f(rain[i].pos.x, rain[i].pos.y, rain[i].pos.z+5);
-
- rain[i].pos.z-=4.0f;
- if(rain[i].pos.z<0)
- {
- rain[i].pos.x=(float)(rand()%300);
- rain[i].pos.y=(float)(rand()%200);
- rain[i].pos.z=100.0f;
- }
- }
- glEnd();
- }
-
- void renderwall(void)
- {
- glBindTexture(GL_TEXTURE_2D, texture[WALL_TEXTURE]);
- glBegin(GL_QUADS);
- if(wall<15 && wall>0)
- {
- if(timeofday==0)
- glColor3f(0.9f, 0.9f, 0.9f);
- else
- glColor3f(0.5f, 0.5f, 0.5f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(152.0f, 0.0f, (float)wall);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(148.0f, 0.0f, (float)wall);
- glTexCoord2f(0.0f, -15.0f);
- glVertex3f(148.0f, 200.0f, (float)wall);
- glTexCoord2f(1.0f, -15.0f);
- glVertex3f(152.0f, 200.0f, (float)wall);
- if(timeofday==0)
- glColor3f(0.3f, 0.3f, 0.3f);
- else
- glColor3f(0.1f, 0.1f, 0.1f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(152.0f, 200.0f, (float)wall);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(148.0f, 200.0f, (float)wall);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(148.0f, 200.0f, 0.0f);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(152.0f, 200.0f, 0.0f);
- }
- else if(wall>=15)
- {
- if(timeofday==0)
- glColor3f(0.9f, 0.9f, 0.9f);
- else
- glColor3f(0.5f, 0.5f, 0.5f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(152.0f, 0.0f, 15.0f);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(148.0f, 0.0f, 15.0f);
- glTexCoord2f(0.0f, -15.0f);
- glVertex3f(148.0f, 200.0f, 15.0f);
- glTexCoord2f(1.0f, -15.0f);
- glVertex3f(152.0f, 200.0f, 15.0f);
- if(timeofday==0)
- glColor3f(0.3f, 0.3f, 0.3f);
- else
- glColor3f(0.1f, 0.1f, 0.12f);
- glTexCoord2f(1.0f, 1.0f);
- glVertex3f(152.0f, 200.0f, 15.0f);
- glTexCoord2f(0.0f, 1.0f);
- glVertex3f(148.0f, 200.0f, 15.0f);
- glTexCoord2f(0.0f, 0.0f);
- glVertex3f(148.0f, 200.0f, 0.0f);
- glTexCoord2f(1.0f, 0.0f);
- glVertex3f(152.0f, 200.0f, 0.0f);
- }
- glEnd();
- glColor3f(0.5f, 0.5f, 0.5f);
- glPrint(291, 400, 0, "%d%d:%d%d", wall/25/60/10, wall/25/60%10, wall/25%60/10, wall/25%10);
- }
-
-
- void renderstatus(void)
- {
- int i, x;
- static int liferotation=0;
- liferotation++;
- if(liferotation==360)
- liferotation=0;
-
- glTranslatef(-170, -80, -300);
- for(i=0; i<2; i++)
- {
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_TEXTURE_2D);
- if(i==0)
- glBindTexture(GL_TEXTURE_2D, texture[REDTANK_TEXTURE]);
- if(i==1)
- glBindTexture(GL_TEXTURE_2D, texture[BLUETANK_TEXTURE]);
- glRotatef(-45, 1, 0, 0);
- for(x=0; x<player[i].lives; x++)
- {
- glTranslatef(20, 0, 0);
- glRotatef((float)liferotation, 0, 0, 1);
- if(x<7)
- glCallList(model[TANK_MODEL]);
- glRotatef((float)-liferotation, 0, 0, 1);
- }
- glTranslatef((float)(-20*player[i].lives), 0, 0);
- glRotatef(45, 1, 0, 0);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_DEPTH_TEST);
-
-
- glEnable(GL_TEXTURE_2D);
- if(player[i].mode==BRICK_MODE)
- glColor3f(1.0f, 1.0f, 0.0f);
- else
- glColor3f(0.7f, 0.3f, 0.0f);
- glPrint(10+(320*i), 55, 1, "Bricks: %d", player[i].ammo.bricks);
- if(player[i].mode==MINE_MODE)
- glColor3f(1.0f, 1.0f, 0.0f);
- else
- glColor3f(0.7f, 0.3f, 0.0f);
- glPrint(10+(320*i), 40, 1, "Mines: %d", player[i].ammo.mines);
- if(player[i].mode==MISSLE_MODE)
- glColor3f(1.0f, 1.0f, 0.0f);
- else
- glColor3f(0.7f, 0.3f, 0.0f);
- glPrint(10+(320*i), 25, 1, "Missles: %d", player[i].ammo.missles);
- if(player[i].mode==GRENADE_MODE)
- glColor3f(1.0f, 1.0f, 0.0f);
- else
- glColor3f(0.7f, 0.3f, 0.0f);
- glPrint(10+(320*i), 10, 1, "Grenades: %d", player[i].ammo.grenades);
- glDisable(GL_TEXTURE_2D);
-
- glTranslatef(165, 0, 0);
- }
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_TEXTURE_2D);
- }
-
-